package com.zbkj.admin.controller.platform.assistant;

import com.zbkj.admin.controller.platform.assistant.service.AssistantConversationTransferService;
import com.zbkj.common.model.assistant.AssistantConversationTransfer;
import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.result.CommonResult;
import com.zbkj.service.assistant.model.request.AssistantConversationTransferRequest;
import com.zbkj.service.assistant.model.request.AssistantConversationTransferSearchRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * 会话转接记录表 前端控制器
 */
@Slf4j
@RestController
@RequestMapping("api/admin/platform/assistant/conversation-transfer")
@Api(tags = "客服-会话转接记录") //配合swagger使用

public class AssistantConversationTransferController {

    @Autowired
    private AssistantConversationTransferService assistantConversationTransferService;

    /**
     * 分页显示会话转接记录表
     * @param request 搜索条件
     * @param pageParamRequest 分页参数
     * @author keNan
     * @since 2025-06-11
     */
    @ApiOperation(value = "分页列表") //配合swagger使用
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public CommonResult<CommonPage<AssistantConversationTransfer>>  getList(@Validated AssistantConversationTransferSearchRequest request, @Validated PageParamRequest pageParamRequest) {
        CommonPage<AssistantConversationTransfer> assistantConversationTransferCommonPage = CommonPage.restPage(assistantConversationTransferService.getPage(request, pageParamRequest));
        return CommonResult.success(assistantConversationTransferCommonPage);
    }

    /**
     * 会话转接
     */
    @ApiOperation(value = "会话转接")
    @RequestMapping(value = "/transfer", method = RequestMethod.POST)
    public CommonResult<String> save(@RequestBody @Validated AssistantConversationTransferRequest request) {
        assistantConversationTransferService.transfer(request);
        return CommonResult.success();
    }

    /**
     * 查询会话转接记录表信息
     * @param id Integer
     * @author keNan
     * @since 2025-06-11
     */
    @ApiOperation(value = "详情")
    @RequestMapping(value = "/info", method = RequestMethod.GET)
    public CommonResult<AssistantConversationTransfer> info(@RequestParam(value = "id") Integer id) {
        AssistantConversationTransfer assistantConversationTransfer = assistantConversationTransferService.getById(id);
        return CommonResult.success(assistantConversationTransfer);
    }
}



